package com.usian.controller;

import com.usian.api.admin.RegisterControllerApi;
import com.usian.model.admin.dtos.RegisterDto;
import com.usian.model.admin.pojos.AdUser;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/send")
public class RegisterController implements RegisterControllerApi {
    @Autowired
    private RegisterService registerService;


    @Override
    @RequestMapping("/sendCode")
    public ResponseResult sendCode(String phone) {
        return registerService.sendCode(phone);
    }

    @RequestMapping("/register")
    public ResponseResult register(@RequestBody RegisterDto registerDto) {
        return registerService.register(registerDto);
    }
    @RequestMapping("/findUserByPhone")
    public AdUser findUserByPhone(String phone) {
        return registerService.findUserByPhone(phone);
    }
}
